package com.fsgom.gool.repository;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import com.fsgom.gool.bean.GoolUserInfo;

@Repository
public class GoolUserInfoRepositoryImpl implements GoolUserInfoRepository {
	
	private static final String NAMESPACE = GoolUserInfoRepositoryImpl.class.getName() + ".";
	
	@Autowired
	private SqlMapClientTemplate client;

	@SuppressWarnings("unchecked")
	@Override
	public GoolUserInfo selectUserInfo(Map<String, Object> params) {
		List<GoolUserInfo> userInfos = client.queryForList(NAMESPACE + "selectUserInfo", params);
		if (!CollectionUtils.isEmpty(userInfos)) {
			return userInfos.get(0);
		}
		return null;
	}
	@Override
	public void insertUserInfo(Map<String, Object> params) {
		client.insert(NAMESPACE + "insertUserInfo", params);
	}
}
